<?php

namespace App\Service;


use App\Models\Advertising;
use App\Models\Banner;

class BannerService
{
    /**
     * 取出5条广告位
     * @param int $type  1 首页（默认）
     * @return mixed
     */
    public function getBanners($type = 1)
    {
        return Banner::where('type', $type)
            ->orderBy('sort', 'desc')
            ->take(5)
            ->get();
    }

    // 获取广告位
    public function getAds()
    {
        return Advertising::all();
    }
}
